#
# Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
#
#   GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
#   Author :  Shawn.Tan
#   Date : 2025.10.28
#
#   History : Initial Version 2025.10.28
#
#
from gpgpu.EnvGPGPU import EnvGPGPU
from gpgpu.GenThreadGPGPU import GenThreadGPGPU
from base.Sequence import Sequence
from DV.gpgpu.trees.instruction_tree import ALU_Int_All_instructions
from DV.gpgpu.trees.instruction_tree import ALU_Int32_All_instructions
from DV.gpgpu.trees.instruction_tree import LDST_All_instructions
from DV.gpgpu.trees.instruction_tree import LDST32_All_instructions


class Bunch_of_ALU_Int(Sequence):
    def generate(self, **kwargs):
        self.notice("Generating in 'Bunch_of_ALU_Int'")
        for _ in range(self.random32(5, 20)):
            instr = self.pickWeighted(ALU_Int_All_instructions)
            self.genInstruction(instr)


class Bunch_of_ALU_Int32(Sequence):
    def generate(self, **kwargs):
        self.notice("Generating in 'Bunch_of_ALU_Int32'")
        for _ in range(self.random32(5, 20)):
            instr = self.pickWeighted(ALU_Int32_All_instructions)
            self.genInstruction(instr)


class Bunch_of_LDST(Sequence):
    def generate(self, **kwargs):
        self.notice('Generating in "Bunch_of_LDST"')
        for _ in range(self.random32(5, 20)):
            instr = self.pickWeighted(LDST_All_instructions)
            instr_rec_id = self.genInstruction(instr)


class Bunch_of_LDST32(Sequence):
    def generate(self, **kwargs):
        self.notice('Generating in "Bunch_of_LDST32"')
        for _ in range(self.random32(5, 20)):
            instr = self.pickWeighted(LDST32_All_instructions)
            instr_rec_id = self.genInstruction(instr)
